import React, { Component } from 'react'
import BScroll from 'better-scroll'
import './index.scss'
class ListView extends Component {
  constructor(props) {
    super(props)
    this.scroll = null
  }
  componentDidMount() {
    const warpper = window.document.querySelector('.scroll')
    this.scroll = new BScroll(warpper, {
      scrollX: false,
      scrollY: true,
      click: true
    })
  }
  componentDidUpdate(props) {
    this.scroll.refresh()
  }
  render() {
    return <div className="list-view scroll">{this.props.children}</div>
  }
}

export default ListView
